home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0669.ZIP / MOUSE.PRG < prev    next >
Text File  |  1987-08-11  |  3KB  |  127 lines

  1. * mouse.prg
  2. * derived from Turbo Prolog program mouse.pro
  3. * requires inter.bin
  4. * Andrew Schulman, 12 Humboldt Street, Cambridge MA 02140, 617-876-2102
  5. * 8/11/87
  6. * tested in dBase III Plus and FoxBase+ 2.0
  7.  
  8. if .not. file("inter.bin")
  9.     ? "This program requires INTER.BIN and a Microsoft-" + ;
  10.         "compatible mouse"
  11.     return
  12. endif
  13.  
  14. set talk off
  15. set echo off
  16. set scoreboard off
  17.  
  18. load inter
  19. beeper = .f.
  20. if file("beep.bin")
  21.     load beep
  22.     beeper = .t.
  23. endif
  24.  
  25. set proc to mouse
  26. do main
  27. set proc to
  28.  
  29. proc main
  30.     okay = .f.
  31.     do ms_init
  32.     if .not. okay
  33.         ? "Can't find MOUSE"
  34.         return
  35.     endif
  36.     clear
  37.     @ 1,0 say "INTER.BIN LETS YOU DO MICROSOFT MOUSE (INT 51) PROGRAMMING" + ;
  38.         " IN dBASE"
  39.     @ 2,0 say "Click the RIGHT mouse button (or select Quit) when done"
  40.     @ 3,0 to 3,78 double
  41.     do menu with 0
  42.     @ 5,0 to 5,78 double
  43.     
  44.     do ms_show
  45.     store 0 to row,col,button
  46.     do while (button <> 2)    && right button to quit
  47.         do ms_stat
  48.         if (beeper .and. row > 3 .and. button = 1)        && left button
  49.             call beep with str(col*row) + " 4"
  50.         endif
  51.         if (button = 1 .and. row = 4)        && in the menu bar
  52.             do menu with iif(col>=00 .and. col<11, 1, ;
  53.                          iif(col>=11 .and. col<22, 2, ;
  54.                          iif(col>=22 .and. col<35, 3, 4)))
  55.         endif
  56.     enddo
  57.     @ 20,0 say "Done!  Remember, you can do all sorts of neat things with" + ;
  58.         " INTER.BIN"
  59.     do ms_hide
  60. return
  61.  
  62. proc ms_init
  63.     ax = 0
  64.     do inter with 51,ax,0,0,0
  65.     if (ax <> 0)
  66.         okay = .t.
  67.     endif
  68. return
  69.  
  70. proc ms_show
  71.     do inter with 51,1,0,0,0
  72. return
  73.  
  74. proc ms_hide
  75.     do inter with 51,2,0,0,0
  76. return
  77.  
  78. proc ms_stat
  79.     * left button = 1, right button = 2, no button down = 0
  80.     * both buttons down = 3
  81.     store 0 to button,col,row
  82.     do inter with 51,3,button,col,row
  83.     col = col / 8
  84.     row = row / 8
  85. return
  86.  
  87. proc ms_setpos
  88.     param row,col
  89.     do inter with 51,4,(col*8),(row*8),0
  90. return
  91.  
  92. proc inter
  93.     param intno,ax,bx,cx,dx
  94.     cmd = ltrim(str(intno)+str(ax)+str(bx)+str(cx)+str(dx))+space(10)
  95.     call inter with cmd
  96.     * parse return string into registers
  97.     ax=int(val(substr(cmd,1,5)))
  98.     bx=int(val(substr(cmd,7,5)))
  99.     cx=int(val(substr(cmd,13,5)))
  100.     dx=int(val(substr(cmd,19,5)))
  101. return
  102.  
  103. proc menu
  104.     param which
  105.     @ 4,0 say "Menu 1  "
  106.     @ 4,11 say "Menu 2  "
  107.     @ 4,22 say "Menu 3    "
  108.     @ 4,35 say "Quit"
  109.     @ 20,0 clear to 20,78
  110.     do case
  111.         case (which = 1)
  112.             @ 4,0 say "MENU ONE"
  113.             @ 20,0 say "You clicked on menu number one"
  114.         case (which = 2)
  115.             @ 4,11 say "MENU TWO"
  116.             @ 20,0 say "You selected the second menu item"
  117.         case (which = 3)
  118.             @ 4,22 say "MENU THREE"
  119.             @ 20,0 say "You picked the third menu"
  120.         case (which = 4)
  121.             @ 4,35 say "QUIT!"
  122.             button = 2
  123.     endcase
  124. return
  125.  
  126.  
  127.